#! /bin/sh
# aoe-init - example init script for ATA over Ethernet storage
# 
#   Edit this script for your purposes.  (Changing "eth1" to the
#   appropriate interface name, adding commands, etc.)  You might
#   need to tune the sleep times.
#
#   Install this script in /etc/init.d with the other init scripts.
#
#   Make it executable:
#     chmod 755 /etc/init.d/aoe-init
#
#   Install symlinks for boot time:
#     cd /etc/rc3.d && ln -s ../init.d/aoe-init S99aoe-init
#     cd /etc/rc5.d && ln -s ../init.d/aoe-init S99aoe-init
#
#   Install symlinks for shutdown time:
#     cd /etc/rc0.d && ln -s ../init.d/aoe-init K01aoe-init
#     cd /etc/rc1.d && ln -s ../init.d/aoe-init K01aoe-init
#     cd /etc/rc2.d && ln -s ../init.d/aoe-init K01aoe-init
#     cd /etc/rc6.d && ln -s ../init.d/aoe-init K01aoe-init
#

case "$1" in
        "start")
                # load any needed network drivers here

                # replace "eth1" with your aoe network interface
                ifconfig eth1 up

                # time for network interface to come up
                sleep 4

                modprobe aoe

                # time for AoE discovery and udev
                sleep 7

                # add your raid assemble commands here
                # add any LVM commands if needed (e.g. vgchange)
                # add your filesystem mount commands here

                test -d /var/lock/subsys && touch /var/lock/subsys/aoe-init
                ;;
        "stop")
                # add your filesystem umount commands here
                # deactivate LVM volume groups if needed
                # add your raid stop commands here
                rmmod aoe
                rm -f /var/lock/subsys/aoe-init
                ;;
        *)
                echo "usage: `basename $0` {start|stop}" 1>&2
                ;;
esac